﻿namespace PMS.Client.FrmOrganRole
{
    using PMS.BLL;
    using PMS.Model;
    using System;
    using System.ComponentModel;
    using System.Drawing;
    using System.Windows.Forms;

    public class FrmUpdate : Form
    {
        private OrganRoleBLL bll = new OrganRoleBLL();
        private Button btnCancel;
        private Button btnSave;
        private IContainer components = null;
        private Label label1;
        private OrganRole model = null;
        private TextBox textBox1;

        public FrmUpdate(int typeid)
        {
            this.InitializeComponent();
            this.model = this.bll.GetModel(typeid);
            this.textBox1.Text = this.model.RoleName;
        }

        private void btnCancel_Click(object sender, EventArgs e)
        {
            base.Close();
        }

        private void btnSave_Click(object sender, EventArgs e)
        {
            if (this.textBox1.Text.Trim() != "")
            {
                this.model.RoleName = this.textBox1.Text.Trim();
                if (this.bll.Update(this.model))
                {
                    base.DialogResult = DialogResult.OK;
                }
                else
                {
                    MessageBox.Show("修改失败！");
                }
            }
        }

        protected override void Dispose(bool disposing)
        {
            if (disposing && (this.components != null))
            {
                this.components.Dispose();
            }
            base.Dispose(disposing);
        }

        private void InitializeComponent()
        {
            ComponentResourceManager manager = new ComponentResourceManager(typeof(FrmUpdate));
            this.label1 = new Label();
            this.textBox1 = new TextBox();
            this.btnCancel = new Button();
            this.btnSave = new Button();
            base.SuspendLayout();
            this.label1.AutoSize = true;
            this.label1.Location = new Point(12, 0x23);
            this.label1.Name = "label1";
            this.label1.Size = new Size(0x35, 12);
            this.label1.TabIndex = 0;
            this.label1.Text = "性质名称";
            this.textBox1.BackColor = Color.FromArgb(0xd9, 0xea, 0xf7);
            this.textBox1.BorderStyle = BorderStyle.FixedSingle;
            this.textBox1.Location = new Point(0x47, 0x20);
            this.textBox1.Name = "textBox1";
            this.textBox1.Size = new Size(0xc0, 0x15);
            this.textBox1.TabIndex = 1;
            this.btnCancel.BackColor = Color.White;
            this.btnCancel.FlatStyle = FlatStyle.Popup;
            this.btnCancel.Location = new Point(0xbc, 90);
            this.btnCancel.Name = "btnCancel";
            this.btnCancel.Size = new Size(0x4b, 0x17);
            this.btnCancel.TabIndex = 6;
            this.btnCancel.Text = "取消";
            this.btnCancel.UseVisualStyleBackColor = false;
            this.btnCancel.Click += new EventHandler(this.btnCancel_Click);
            this.btnSave.BackColor = Color.White;
            this.btnSave.FlatStyle = FlatStyle.Popup;
            this.btnSave.Location = new Point(0x47, 90);
            this.btnSave.Name = "btnSave";
            this.btnSave.Size = new Size(0x4b, 0x17);
            this.btnSave.TabIndex = 5;
            this.btnSave.Text = "保存";
            this.btnSave.UseVisualStyleBackColor = false;
            this.btnSave.Click += new EventHandler(this.btnSave_Click);
            base.AutoScaleDimensions = new SizeF(6f, 12f);
            base.AutoScaleMode = AutoScaleMode.Font;
            this.BackColor = Color.FromArgb(0xa4, 0xc4, 0xeb);
            base.ClientSize = new Size(0x12f, 0x7d);
            base.Controls.Add(this.btnCancel);
            base.Controls.Add(this.btnSave);
            base.Controls.Add(this.textBox1);
            base.Controls.Add(this.label1);
            base.FormBorderStyle = FormBorderStyle.FixedSingle;
            base.Icon = (Icon) manager.GetObject("$this.Icon");
            base.MaximizeBox = false;
            base.MinimizeBox = false;
            base.Name = "FrmUpdate";
            base.StartPosition = FormStartPosition.CenterScreen;
            this.Text = "修改性质类别";
            base.ResumeLayout(false);
            base.PerformLayout();
        }
    }
}

